<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" charset="UTF-8" />
    <title>减少声明及语句数</title> 
</head> 
<body>
    <div id="box" style="width: 100px;height: 100px;"></div>
<script type="text/javascript">
// var oBox = document.getElementById('box')

// var test = (ele) => {
//     let w = ele.offsetWidth
//     let h = ele.offsetHeight
//     return w * h
// }

// var test = (ele) => {
//     return ele.offsetWidth * ele.offsetHeight
// }
// console.log(text(oBox))

var test = () => {// 更倾向于这样写，代码结构清晰一些，有利于维护
    var name = 'zce'
    var age = 38
    var slogan = '我为前端而活'
    return name + age + slogan
}

var test = () => {
    var name = 'zce',
         age = 38,
        slogan = '我为前端而活'
    return name + age + slogan
}
console.log(test())
</script> 
</body> 
</html>